package com.app.micaihu.view.army.adapter

import com.app.micaihu.R
import com.app.micaihu.view.bean.ArmyGrade
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder

/**
 * 官职设置 适配器
 */
class ArmyOfficialPositionListAdapter : BaseQuickAdapter<ArmyGrade, BaseViewHolder>(R.layout.army_official_position_grade_list_item) {

    override fun convert(holder: BaseViewHolder, item: ArmyGrade) {
        holder.apply {
            if (1 == item.permission) {
                setBackgroundResource(R.id.tvGrade, R.drawable.army_member_grade_bg)
            } else {
                setBackgroundResource(R.id.tvGrade, R.drawable.army_member_grade_no_bg)
            }
            setText(R.id.tvLevel, item.level)
            setText(R.id.tvGrade, item.name)
        }
    }
}